#  -*- coding:utf-8 -*- 
"""
@ author: 罗金盛
@ time: 2024/3/6 
@ file: 6.类的基本特征.py

"""
# 继承

class Human:
    def __init__(self,name):
        self.name = name
        print('self->',self)

    def speak(self):
        print('Human在讲话！'+self.name)

    def __test__(self):  # 带下划线的不能被继承，相当于是私有
        print('这个不能被继承！！！')

class LJS(Human):
    def __init__(self,name):
        self.ljs = name
        super(LJS, self).__init__(name)  # 调用父类的init

    # 覆盖 子类新写的方法会覆盖父类的方法
    def speak(self):
        print('罗大帅在讲话！'+self.name)
        super(LJS, self).speak() # 当方法名一样 想用父类的时候 就用super

    def fly(self):
        print('我会飞了！')

l = LJS('ljs')
l.speak()
l.fly()